(function (aopc) {
    aopc.addExpandPage(799, function (get) {
        const Common = get('UtilsCommon', 'Common');
        const Bridge = get('UtilsCommon', 'Bridge');
        return {
            expandInit() {
                this.selectStatus = {};
                this.ok_dialog_view = this.getProperty('ok_dialog_view');
                this.passwordProperty = this.getProperty('Password');
            },
            setChecked({ property }) {
                const { name, style } = property;
                const s = this.selectStatus;
                s[name] = !s[name];
                if (this.theme === 'red') style.backgroundColor = s[name] ? '#F92A2A' : '#EECACA';
                else style.backgroundColor = s[name] ? '#449AEB' : '#BAC8DC';
                style.justifyContent = s[name] ? 'flex-end' : 'flex-start';
                property.refresh();
            },
            setReset() {
                const { isSignInfo, isMeetingAnnotation, isVote, isMeetingData } = this.selectStatus;
                if (!isSignInfo && !isMeetingAnnotation && !isVote && !isMeetingData) {
                    this.alert('请至少选择一项！');
                    return;
                }
                this.ok_dialog_view.setIsVisible(true);
            },
            expandSetEntityData({ entityData }) {
                if (Common.isNullOrEmpty(entityData.Password)) {
                    this.alert('请输入密码！');
                    return false;
                }
                const password = this.visitUser.AdminPassword || 'admin';
                if (entityData.Password !== password) {
                    this.alert('密码错误！');
                    return false;
                }
                delete entityData.Password;
                const { isSignInfo, isMeetingAnnotation, isVote, isMeetingData } = this.selectStatus;
                entityData.IsSignInfo = isSignInfo;
                entityData.IsMeetingAnnotation = isMeetingAnnotation;
                entityData.IsVote = isVote;
                entityData.IsMeetingData = isMeetingData;
                return entityData;
            },
            expandDataLoad({ data }) {
                this.meeting = data;
            },
            successCallback() {
                this.alertSuccess('操作成功', () => {
                    this.ok_dialog_view.setIsVisible(false);
                    const { IsInSign, IsWelcomePage, MeetingId } = this.meeting;
                    const data = { MeetingId, IsReset: true, IsInSign, IsWelcomePage };
                    Bridge.jsToNative('resetMeeting', data);
                    this.webSocket.send('resetMeeting', data);

                    if (IsWelcomePage) {
                        this.replacePage('/welcome.html?MeetingId=' + MeetingId + "&backUrl=" + encodeURIComponent('/index.html'));
                        return;
                    }
                    else if (IsInSign) {
                        this.replacePage('/userSign.html?MeetingId=' + MeetingId + "&backUrl=" + encodeURIComponent('/index.html'));
                        return;
                    }
                    else {
                        this.replacePage('/meetingSubjectList.html?MeetingId=' + MeetingId);
                    }
                });
            }
        }
    });
})(window.aopc);